package xyz.ddlnt.servicemg.controller;

import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.entity.AdminInfo;
import xyz.ddlnt.servicemg.service.AdminService;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/9 15:42
 */
@Slf4j
@RequestMapping("/admin")
@RestController
@RequiredArgsConstructor
public class AdminController {

    @Resource
    private AdminService adminService;

    /**
     * 管理员登录
     * @param adminInfo
     * @return
     */
    @PostMapping("login")
    public Result<String> login(@RequestBody AdminInfo adminInfo) {
        return Result.success(adminService.login(adminInfo));
    }

    /**
     * 管理员注册
     * @param adminInfo
     * @return
     */
    @PostMapping("register")
    public Result<Boolean> register(@RequestBody AdminInfo adminInfo) {
        return Result.success(adminService.register(adminInfo));
    }

}
